﻿using System;
using System.ComponentModel.DataAnnotations;

namespace assignment1
{
    class fuction
    {
        public void q2caArr(int[] arr, out int max, out int min, out int average, out int sum)
        {
            max = arr[0]; min = arr[0]; average = 0; sum = arr[0];
            for (int i = 1; i < arr.Length; i++)
            {
                if (arr[i] > max)
                {
                    max = arr[i];
                }
                else if (arr[i] < min)
                {
                    min = arr[i];
                }
                sum += arr[i];
            }
            average = sum / arr.Length;
        }
    }
    class ExecuteFunction
    {
        static void Main(string[] args)
        {
            fuction f = new fuction();

            //q2
            int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8 };
            int max, min, average, sum;
            f.q2caArr(arr, out max, out min, out average, out sum);
            Console.WriteLine($"{max} {min} {average} {sum}");


        }
    }
}

